<?php


define( 'd', 'die' );


function ver(){

    $parar = false;

    $caminho = array_shift(debug_backtrace());
    echo '
        <div style="background-color: #ddd; color: #000; font-size: 14px;">
        <div>
            <label>
                Linha   --> <label class="valorCaminho">'.$caminho['line']    .'</label><br />
                Caminho --> <label class="valorCaminho">'.$caminho['file']    .'</label><br />
            </label>
        </div>';

    echo '<div><pre>';


    foreach( $caminho['args'] as $indice => $valor ){

        if(  $valor == 'die' ) $parar = true;
        echo '<label style="color:red; font-weight: bold;">Argumento '.( $indice + 1 ).'</label><br />';
        print_r( $valor );
        echo '<br /><br />';

    }

    echo '</div></pre></div>';


    // Verifica se é para dar o die no final
    if( $parar ){ die; }
}

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
include 'Zend/Application.php';

if ('production' != APPLICATION_ENV) {
    $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
} else {
    include 'Zend/Cache.php';
    include 'Zend/Config/Ini.php';

    $frontend = array('lifetime' => 0, 'automatic_serialization' => true, 'cache_id_prefix' => 'cevx');
    $backend  = array('cache_dir' => sys_get_temp_dir() . '/cache');

    // Getting a Zend_Cache_Core object
    $zend_cache = Zend_Cache::factory('Core', 'FILE', $frontend, $backend);
    if (!$application_ini = $zend_cache->load('iniApplication')) {
        $application_ini = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV, array('allowModifications' => true));
        $aConfigs = $application_ini->config;
        foreach ($aConfigs as $configIni) {
            $application_iniConfig = new Zend_Config_Ini($configIni, APPLICATION_ENV);
            $application_ini = $application_ini->merge($application_iniConfig);
        }
        $application_ini = $application_ini->toArray();
        $zend_cache->save($application_ini, 'iniApplication');
    }
    $application = new Zend_Application(APPLICATION_ENV, $application_ini);
}

// Create application, bootstrap, and run
$application->bootstrap()
            ->run();
